//
//  RBKStartManager.m
//  RuiBeiKang
//
//  Created by 江伟 on 2018/12/21.
//  Copyright © 2018年 JW. All rights reserved.
//

#import "RBKStartManager.h"
#import "BaseTabBarVC.h"
#import "BaseNavigationVC.h"


#define ISLOGIN \
\
STR_Is_NullOrEmpty([USERDEFAULT objectForKey:TokenKEY]) || (STR_Is_NullOrEmpty([USERDEFAULT objectForKey:First_loginKEY])) || ([[USERDEFAULT objectForKey:First_loginKEY] integerValue] == 0)

@interface RBKStartManager()
@property (nonatomic,strong) UIWindow *window;

@end

@implementation RBKStartManager
+ (RBKStartManager *)shareManager {
    static RBKStartManager *instance = nil;
    static dispatch_once_t oneToken;
    dispatch_once(&oneToken,^{
        instance = [[RBKStartManager alloc] init];
    });
    return instance;
}

- (instancetype)init{
    self = [super init];
    if (self) {
        //在UIApplicationDidFinishLaunching时初始化开屏广告,做到对业务层无干扰,当然你也可以直接在AppDelegate didFinishLaunchingWithOptions方法中初始化
    }
    return self;
}

+ (void)configLogin {
    RBKStartManager *manager = [self shareManager];
    [manager setupLogin];
}

- (void)setupLogin {
//    if (ISLOGIN) {
//        [RBKLoginVC setupFirstLogin];
//    } else {
//        KEYWINDOW.rootViewController = [BaseTabBarVC new];
//    }
}

- (UIWindow *)window {
    if (!_window) {
        _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    }
    return _window;
}

@end
